<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8" />
    <title>9527处理</title>
    <script th:src="@{/js/jquery.js}"></script>

</head>
<body>

<form name="billInfo">
    <table>
        <tr>
            <td>流水号:</td>
            <td><input type="text"  name="detailsId" style="width: 320px" /></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="查询" onclick="add()" />
            </td>

            <td colspan="2">
                <input type="button" value="重试代办" onclick="retry()" />
            </td>

            <td colspan="2">
                <input type="button" value="插充值记录" onclick="insertpayrecord()" />
            </td>
        </tr>
    </table>

    <div id="result">

    </div>



</form>
</body>


<script type="text/javascript">


     //   $(document).ready(function(){
            function add(){
                var detailsId = billInfo.detailsId.value;
                $.post("/todo_submit",
                {"detailsId":detailsId},
                function(data){
                $("#result").empty();
                var html="<h3>充值金额:"+data.money+"</h3>"
                    html+="<h3>9527卡住时间:"+data.updateTime+"</h3>"

                 html+=" <table class='result' ><tr> <th>采样时间</th><th>余额</th><th>透支</th></tr>";
                for (var i=0;i<data.list.length;i++){
                    var item=data.list[i];
                    var item1=data.list_1[i];
                    html+="<tr><td>"+item.timestr+"</td><td>"+item.samplevalue+"</td><td>"+item1.samplevalue+"</td></tr>"
                }
                    html+="</table>";

                    html+=" <table class='result'><tr> <th>充值时间</th><th>充值金额</th></tr>";
                    for (var i=0;i<data.list1.length;i++){
                        var item=data.list1[i];
                        html+="<tr><td>"+item.rechargetimeStr+"</td><td>"+item.paycount+"</td></tr>"
                    }
                    html+="</table>";
                    $("#result").append(html);

                });
            }

            function retry(){
                var detailsId = billInfo.detailsId.value;
                $.post("/todo_retry",
                    {"detailsId":detailsId},
                    function(data){
                        if(data == true){
                            alert("成功");
                        }
                        if(data == false){
                            alert("失败");
                        }

                    });
            }

            function insertpayrecord(){
                var detailsId = billInfo.detailsId.value;
                $.post("/todo_insert_payrecord",
                    {"detailsId":detailsId},
                    function(data){
                        if(data == true){
                            alert("成功");
                        }
                        if(data == false){
                            alert("失败");
                        }

                    });
          }
    //    });
</script>
<style>
    .result,.result tr th,.result tr td{
        border: 1px solid #ccc;
    }
    .result
    {
         border-collapse: collapse;
        border-spacing:0px 10px;
     }
    .result tr th,result tr td{
        width: 200px;
    }

</style>
</html>